using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using JGSY.CMS.LowCode.Platform.Domain.Entities;

namespace JGSY.CMS.LowCode.Platform.Domain.Interfaces
{
    /// <summary>
    /// 模板仓储接口
    /// </summary>
    public interface ITemplateRepository : IRepository<Template>
    {
        /// <summary>
        /// 根据类型获取模板列表
        /// </summary>
        /// <param name="type">模板类型</param>
        /// <returns>模板列表</returns>
        Task<List<Template>> GetByTypeAsync(string type);
        
        /// <summary>
        /// 根据分类获取模板列表
        /// </summary>
        /// <param name="category">模板分类</param>
        /// <returns>模板列表</returns>
        Task<List<Template>> GetByCategoryAsync(string category);
        
        /// <summary>
        /// 根据名称获取模板
        /// </summary>
        /// <param name="name">模板名称</param>
        /// <returns>模板实体</returns>
        Task<Template?> GetByNameAsync(string name);
        
        /// <summary>
        /// 获取默认模板
        /// </summary>
        /// <param name="type">模板类型</param>
        /// <returns>默认模板</returns>
        Task<Template?> GetDefaultAsync(string type);
        
        /// <summary>
        /// 检查模板名称是否存在
        /// </summary>
        /// <param name="name">模板名称</param>
        /// <param name="excludeId">排除的模板ID</param>
        /// <returns>是否存在</returns>
        Task<bool> ExistsAsync(string name, Guid? excludeId = null);
        
        /// <summary>
        /// 获取启用的模板列表
        /// </summary>
        /// <param name="type">模板类型</param>
        /// <returns>启用的模板列表</returns>
        Task<List<Template>> GetEnabledTemplatesAsync(string? type = null);
        
        /// <summary>
        /// 获取系统模板列表
        /// </summary>
        /// <returns>系统模板列表</returns>
        Task<List<Template>> GetSystemTemplatesAsync();
        
        /// <summary>
        /// 获取最近使用的模板列表
        /// </summary>
        /// <param name="count">返回数量</param>
        /// <returns>最近使用的模板列表</returns>
        Task<List<Template>> GetRecentlyUsedAsync(int count = 10);
    }
}
